package com.zhidian.edm.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class Swagger3Config {

    // 按模块定义
    @Bean
    public GroupedOpenApi MonitorApi() {
        return GroupedOpenApi.builder().group("设备管理软件")
                .packagesToScan("com.zhidian.edm.controller")
                .pathsToExclude("/error/**")
                .build();
    }


    // 生成文档
    @Bean
    public OpenAPI docsOpenApi() {
        return new OpenAPI()
                .info(new Info().title("设备管理软件接口文档")
                        .description("设备管理")
                        .version("v1.0"))
                .externalDocs(new ExternalDocumentation()
                        .description("针对于设备进行成果物管理")
                        .url("http://localhost:10086/swagger-ui/index.html"));
    }

}